From John Hay
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 7 Sep 2004 19:34:03 +0000 (19:34 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 7 Sep 2004 19:34:03 +0000 (19:34 +0000)
So here is a patch to make the track output function use the DM format
and to fix the header to also claim that. I decided on DM because by
far most examples I could find used it.

gpsbabel/pcx.c

index a00bb096bd9d24779675ffc371113922266036df..c1cf531974c2da72b12af0a53320c8ee606836c4 100644 (file)
@@ -217,18 +217,26 @@ pcx_track_hdr(const route_head *trk)
 void
 pcx_track_disp(const waypoint *wpt)
 {
+       double lon,lat;
        char tbuf[100];
        struct tm *tm;
        char *tp;
 
+       lon = degrees2ddmm(wpt->longitude);
+       lat = degrees2ddmm(wpt->latitude);
+
        tm = localtime(&wpt->creation_time);
 
        strftime(tbuf, sizeof(tbuf), "%d-%b-%y %T", tm);
        for (tp = tbuf; *tp; tp++) {
                *tp = toupper(*tp);
        }
-       fprintf(file_out, "T  %+011.7f %+012.7f %s %.f\n",
-                       wpt->latitude, wpt->longitude, tbuf, wpt->altitude);
+       fprintf(file_out, "T  %c%08.5f %c%011.5f %s %.f\n",
+                       lat < 0.0 ? 'S' : 'N',
+                       fabs(lat),
+                       lon < 0.0 ? 'W' : 'E',
+                       fabs(lon),
+                       tbuf, wpt->altitude);
 }
 
 
@@ -243,7 +251,7 @@ fprintf(file_out,
 "M  G WGS 84               121 +0.000000e+00 +0.000000e+00 +0.000000e+00 +0.000000e+00 +0.000000e+00\n"
 "\n"
 "H  COORDINATE SYSTEM\n"
-"U  LAT LON DEG\n"
+"U  LAT LON DM\n"
 "\n"
 "H  IDNT   LATITUDE    LONGITUDE    DATE      TIME     ALT   DESCRIPTION                              PROXIMITY     SYMBOL ;waypts\n");
        setshort_length(mkshort_handle, 6);